﻿@model IPagedList<ProductList>
@using EShop.Core;
@using EShop.Core.Model.Store;
@using EShop.Store.Extensions;
@using EShop.Store.Models.Common;

@{
    List<Dimension> dimensionlist = ViewBag.dimension;
    string urlQuery = HttpContext.Current.Request.Url.Query;
    EShop.Services.Store.IDimensionValueService dimensionValueService = EShop.Core.Infrastructure.EngineContext.Current.Resolve<EShop.Services.Store.IDimensionValueService>();
    
}

<script type="text/javascript">
    $(function () {
        var orderby = "@ViewBag.orderby";
        var sort = "@ViewBag.sort";

        $("a[name='aDimensionValue']").click(function () {
            $("#divCategory").append("<span>" + this.dimensionName + "：" + this.innerText + "<a href='#'>×</a></span>");
        });
        if (orderby > 0) {
            if (sort == 1)
                sort = 2;
            else sort = 1;
            $("#order" + orderby).attr("href", "/product/index?orderby=" + orderby + "&sort=" + sort + "");
            $("#order" + orderby).attr("class", sort == 2 ? "asc" : "");
        }

    })

</script>
<div id="main">
    <div class="search-wrap">
        <div class="search-box">
            <table border="0" cellspacing="0" cellpadding="0">

                <tr>
                    <td>
                        <div class="type-box">
                            <select name="type" class="type" id="selSearch">
                                <option value="1">搜索账号名称</option>
                                <option value="2">搜索粉丝量</option>
                            </select>
                        </div>
                    </td>
                    <td>
                        <input name="key" class="key" type="text" id="txtKey" value="请输入您要搜索的关键字">
                        <input name="go" class="go" type="button" id="btnSearch"></td>
                </tr>

            </table>

        </div>
        <div class="xuxian"></div>
        <div class="search-option">
            <table border="0" cellspacing="0" cellpadding="0">
                @foreach (var dimension in dimensionlist)
                {
                    <tr>
                        <td>@dimension.Name：</td>
                        <td><a href="#" class="select" id="a@{@dimension.Id}">不限</a>
                            @foreach (var dimensionValue in dimensionValueService.GetDimensionValueByDimensionId(dimension.Id))
                            {
                                <a href="#" name="aDimensionValue" id="@{@dimensionValue.Id}" dimensionName="@dimension.Name">@dimensionValue.Name</a>
                            }
                        </td>
                    </tr>
                }

            </table>
        </div>
        <div class="select-option">
            <div>您已选择：</div>
            <div id="divCategory"></div>
        </div>
    </div>
    <div class="order-box">
        <div class="order-list">
            <a href="#" class="select">默认排序</a><a href="/product/index?orderby=1&sort=1" id="order1">销量</a><a href="/product/index?orderby=2&sort=1" id="order2">人气</a>
            <a href="/product/index?orderby=3&sort=1" id="order3">信用</a><a href="/product/index?orderby=4&sort=1" id="order4">最新</a><a href="/product/index?orderby=5&sort=1" id="order5">总价</a>
        </div>
        <div class="result">
            找到关联账号：<span class="red">@Model.TotalCount</span>个
        </div>
    </div>
    <div class="result-box">
        <table>
            <thead>
                <tr>
                    <th>账号名称</th>
                    <th>粉丝量</th>
                    <th>转评值</th>
                    <th>硬广转发价</th>
                    <th>软广转发价</th>
                    <th>硬广直发价</th>
                    <th>软广直发价</th>
                    <th>周订单</th>
                    <th>粉丝性别</th>
                    <th>详情</th>
                    <th>平台</th>
                    <th>操作</th>
                </tr>
            </thead>
            @foreach (var m in Model)
            {
                <tr>
                    <td>
                        <img src="../../../../Content/@m.Img_Logo" width="45" height="45"><span>@m.ProductName</span></td>
                    <td><span class="fan-num">@m.FansAmount 万</span><span class="fan-certificate"><a href="#">粉丝以认证</a></span></td>
                    <td>数据不足</td>
                    <td>@m.Price</td>
                    <td>@m.Price</td>
                    <td>@m.Price</td>
                    <td>@m.Price</td>
                    <td>100</td>
                    <td>不限</td>
                    <td><a href="#" class="detail"></a></td>
                    <td><a href="#">
                        <img src="../../../../Content/images/weixin.png" width="31" height="25"></a></td>
                    <td><a href="#">收藏</a><br />
                        <a href="#">举报假号</a></td>
                </tr>
            }
        </table>

    </div>

    <div class="info">没有找到想要使用的账号？告诉我们吧！</div>


    <div class="pages">
        <div class="left">
            @{
                var pager = @Html.Pager(new PagerModel()
                {
                    PageSize = Model.PageSize,
                    TotalRecords = Model.TotalCount,
                    PageIndex = Model.PageIndex,
                    ShowTotalSummary = false,
                    RouteActionName = "",
                    UseRouteLinks = false,
                    RouteValues = new RouteValues { page = 0 }
                });
            }
            @pager
        </div>
        <div class="right">
            <span>共@{@Model.TotalPages}页</span><span>去第<input name="page" type="text">页</span><span><input name="" type="button" value="确定"></span>
        </div>
    </div>
</div>

<script type="text/javascript">

    $(function () {
        $("#btnSearch").click(function () {
            if ($("#txtKey").val() == "请输入您要搜索的关键字")
                $("#txtKey").val("");
            var url = "/product/index?selectSearch=" + $("#selSearch").val() + "&searchStr=" + $("#txtKey").val();
            location.href = url;
        });
    });
</script>
